package edu.nf.llmtest.common.converter;

import edu.nf.llmtest.model.document.ConversationsDoc;
import edu.nf.llmtest.model.entity.Conversations;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;

/**
 * 对话类转换器
 * */
@Mapper(componentModel = "spring")
public interface ConversationsConverter {
    @Mappings(
            {
                    @Mapping(source = "messageId", target = "messageId"),
                    @Mapping(source = "sessionId", target = "sessionId"),
                    @Mapping(source = "userId", target = "userId"),
                    @Mapping(source = "role", target = "role"),
                    @Mapping(source = "message", target = "message"),
                    @Mapping(source = "createdTime", target = "createdTime")
            }
    )
    ConversationsDoc convertConversationsDoc(Conversations conversations);

    @Mappings(
            {
                    @Mapping(source = "messageId", target = "messageId"),
                    @Mapping(source = "sessionId", target = "sessionId"),
                    @Mapping(source = "userId", target = "userId"),
                    @Mapping(source = "role", target = "role"),
                    @Mapping(source = "message", target = "message"),
                    @Mapping(source = "createdTime", target = "createdTime")
            }
    )
    Conversations convertConversations(ConversationsDoc conversationsDoc);
}
